Apparatus and method for determining measure of similarity between images

ABSTRACT

A method and system is presented in image-guided radiosurgery for determining the measure of similarity of two digital images, for example a 2D x-ray image and a 2D DRR synthesized from 3D scan data. A two-dimensional array of pixel values of a difference image is formed by subtracting each pixel value of the second image from the corresponding pixel value of the first image. The pattern intensity function is constructed by taking the summation of asymptotic functions of the gradients of the difference image. The neighborhood R is defined so as to allow the gradients of the difference image to be considered in at least four directions.

FIELD OF THE INVENTION

The present invention relates to an apparatus and method for determiningthe measure of similarity of two images.

BACKGROUND

Radiosurgery is useful for treating tumors and other lesions bydelivering a prescribed high dose of high-energy radiation to the targetarea while minimizing radiation exposure to the surrounding tissue. Inradiosurgery, precisely focused beams of radiation (e.g. very intensex-ray beams) are delivered to a target region in order to destroy tumorsor to treat the tumor for other purposes. The goal is to apply a lethalor other desired amount of radiation to one or more tumors, withoutdamaging the surrounding healthy tissue.

Conventional radiosurgery uses a rigid and invasive stereotactic frameto immobilize the patient prior to diagnostic CT or MRI scanning. Thetreatment planning is then conducted from the diagnostic images. Thetreatment planning software determines the number, intensity, anddirection of the radiosurgical beams that should be cross-fired at thetarget, in order to ensure that a sufficient dose is administeredthroughout the tumor so as to destroy it, without damaging adjacenthealthy tissue. Immobilization of patient is necessary in order tomaintain the spatial relationship between the target and the radiationsource that ensures accurate dose delivery. The frame is fixed on thepatient during the whole treatment process, causing pain andinconvenience to the patient.

Image-guided radiosurgery allows the elimination of such invasive framefixation, during treatment. In an image-guided radiosurgical process,the patient position and the relative alignment of the radiation beamwith respect to the patient target is continuously adjusted. In order toensure the delivery of the correct dose of radiation to the correctlocation, the patient (and target) position during treatment needs to bedetected. This is accomplished by registering the x-ray image acquiredat the treatment time with the diagnostic 3D scan data (e.g., CT, MRI,ultrasound, or PET scan data) obtained pre-operatively at the time oftreatment planning. In the field of medical image registration, thisproblem is categorized as a 2D/3D registration.

In the 2D/3D registration process, similarity measures are useful forcomparing the image intensities in the x-ray images and the DRR images,so that the change in patient position (and thus in target regionposition) that has occurred between the diagnostic scanning and thetaking of real-time images can be accurately detected. Image-guidedradiosurgery requires precise and fast positioning of the target at thetreatment time. In practice, the accuracy should be below 1 mm, and thecomputation time should be on the order of a few seconds. Unfortunately,it is difficult to meet both requirements simultaneously. In order tooptimize the 2D/3D registration process in image-guided radiosurgery, itis necessary to provide an accurate, robust, and efficient similaritymeasure method and system.

SUMMARY OF THE INVENTION

The present invention is directed to an improved method and system forcomparing the measure of similarity of two digital images, inimage-guided radiosurgery. The method is based on pattern intensity, andprovides a more robust, accurate, and efficient solution to the 2D/3Dmedical image registration problem, as compared to other methods knownand used in the art.

The present invention features a method in image-guided radiosurgery fordetermining the measure of similarity of a first image and a secondimage of an object. Preferably, the first image is a real-time 2D x-rayimage, and the second image is an artificially synthesized DRR,constructed from previously generated 3D scans.

The method includes forming a difference image by subtracting thecorresponding pixel values of the second (DRR) image from each pixelvalue of the first, “live,” x-ray image. The method further includesapplying upon each pixel of the difference image a pattern intensityfunction, the pattern intensity function being an asymptotic function ofthe gradients of the difference image.

The mathematical formulation of pattern intensity function is given by:${\sum\limits_{i,j}^{\quad}{\sum\limits_{k,{l \Subset R}}^{\quad}\frac{\sigma^{2}}{\sigma^{2} + \left( {{I_{dif}\left( {i,j} \right)} - {I_{dif}\left( {{i + k},{j + l}} \right)}} \right)^{2}}}},$where I_(dif)(i,j) represents the array of pixel values for thedifference image, where σ is a constant, and where R is a neighborhoodthat uses the pixel (i,j) as a center point.

In a preferred embodiment of the invention, the neighborhood R isdefined so that the gradients of the difference image can be consideredin at least four directions. In an exemplary embodiment, the fourdirections are: substantially horizontal; substantially vertical; about45 degrees; and about −45 degrees.

The present invention features a system for determining the measure ofsimilarity of a 2D x-ray image of an object and a 2D DRR of the objectgenerated from previously obtained 3D scan data. Typically, the x-rayimage and the DRR are discretized digital images, which arecharacterized by a first and second 2D array of pixel values. The systemincludes means for generating 3D scan data of the target, for example aCT scanner, an MRI system, or a PET system. A radiation source(typically an x-ray source) is provided for generating at least oneimaging beam. Imaging means are provided for generating a 2Dradiographic image of the target in near real time, by directing theimaging beam towards and through the target from a known location andangle and at a known intensity, and detecting the imaging beam after thebeam has passed through the target.

The system includes a controller, which contains software for generatinga set of DRR images of the target, using the known location, angle, andintensity of the imaging beam. The controller also includes software fordetermining the measure of similarity between the 2D x-ray image and the2D DRR, by subtracting each pixel value of the second image from acorresponding pixel value of the first image to form a difference image,and then applying upon each pixel of the difference image to form apattern intensity function. The pattern intensity function is anasymptotic function of the gradients of the difference image, andpermits the pixel values within a neighborhood R defined about eachpixel in the difference image to be considered. The gradients aredefined over at least four directions, as discussed above.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates the generation of 2D DRRs from 3D CT scan data of atreatment target within an anatomical region of a patient.

FIG. 2 schematically illustrates the neighborhood for calculatingpattern intensity, in one embodiment of the present invention.

FIG. 3 illustrates a schematic block diagram of a system for determiningthe measure of similarity between an x-ray image of an object, and asynthesized DRR of the object, constructed in accordance with oneembodiment of the present invention.

DETAILED DESCRIPTION

The present invention is directed to a similarity measure, based onpattern intensity, for use in 2D/3D medical image registration.Similarity measures are used to compare two images, each of which havebeen generated using different modalities (e.g., CT versus x-rays), sothat information from one image can be registered onto the other.Similarity measures are useful in procedures such as the 2D/3D medicalimage registration procedures in image-guided radiosurgery. Thesimilarity measure method and system disclosed in the present inventionallows for selected phases of the 2D/3D registration process inimage-guided radiosurgery to be carried out in a more robust, efficient,and powerful manner, as compared to processes carried out using othersimilarity measures known and used in the art.

As explained in the background section, 2D/3D registration is necessaryin order to correct patient position and properly align theradiosurgical beam relative to the target. The x-ray image acquired attreatment time is registered with the 3D scan obtained at the time oftreatment planning. A CT scan is most frequently used for the 3D scan;however, other 3D scanning methods, such as MRI, ultrasound or PETscanning, may also be used. The 3D data is used as the reference todetermine the patient position change during treatment. For thispurpose, 2D reference images are reconstructed from the 3D scan data.Typically, digitally reconstructed radiographs (DRRs) need to begenerated from 3D CT data and are used as the 2D reference images.

FIG. 1 illustrates the generation of 2D DRRs from 3D CT scan data of atreatment target within an anatomical region of a patient. In FIG. 1,the volumetric 3D CT image of the target is schematically referred tousing reference numeral 60. The DRRs 65A and 65B, shown in FIG. 2, areartificial, synthesized 2D images that represent the radiographic imageof the target that would be obtained if imaging beams were used havingthe same intensity, position and angle as the beams used to generate thereal time x-ray projection images, and if the target were positioned inaccordance with the 3D CT scan data. The reference numerals 50A and 50Billustrate the hypothetical positions and angles from which the imagingbeams would be directed through a target positioned in accordance withthe CT volumetric image 60 of the target.

Typically, DRRs are generated by casting hypothetical beams or raysthrough the CT volumetric image of the target. Each ray goes through anumber of voxels of the 3D CT image 60. By integrating the CT numbersfor these voxels along each ray, and projecting onto an imaging plane(shown as 70A and 70B, respectively, in FIG. 2), the resultant imagewould emulate the radiograph that would be obtained by passing rays fromhypothetical locations (50A and 50B, respectively) through a targetpositioned in accordance with the volumetric 3D image 60. Ray tracingalgorithms, known in the art, are generally used to generate DRRs.

Applications such as image-guided radiosurgery require that thecomparison between the DRRs (that contain the 3D CT scan information)and the real-time x-ray images, and consequent adjustment of theposition of the x-ray source, be made very rapidly and accurately. Inpractice, the accuracy should be below 1 mm, and the computation timeshould be on the order of a few seconds. Unfortunately, it is difficultto meet both requirements simultaneously, because of several reasons.First, the two different modality images, i.e. CT scan images and x-rayimages, have different spatial resolution and image quality. Generally,x-ray image resolution and quality are superior to the resolution andquality of DRR images, which are only synthesized images. Typically,some structures in the DRR may appear more blurred (especially normal tothe CT slice plane), compared to the x-ray image. Ideally, an optimalsimilarity measure for a 2D/3D registration process should allow for anaccurate registration to be achieved, despite such differences.

Second, DRR generation relies on a proper attenuation model. Becauseattenuation is proportional to the mass intensity of the target volumethrough which the beam passes, the exact relationship between thetraversed mass intensity and the CT image intensity needs to be known,in order to obtain an accurate modeling. Establishing this relationshipis difficult, however, so the linear attenuation model is often used. Asis known, the linear attenuation coefficient of a material is dependenton x-ray energy. CT machines and x-ray machines work at differenteffective energies, however. As a result, the attenuation coefficientsmeasured by a CT scanner are different from the attenuation of a beam ofx-rays passing through the target. The skeletal structures in DRR imagescannot be reconstructed very well using the linear model, the DRRs beingonly synthetic x-ray projection images. At CT energies, the ratio ofbone-to-soft-tissue attenuation is much lower than at x-ray radiographicenergies. Thus, in a DRR produced from a 3D CT volume, the imagecontrast from soft tissue will be comparable with the image contrastfrom bone, reducing the clarity of bone details, for example.

Finally, x-ray images usually have a large image size (512×512). Forbetter registration accuracy, it is desirable to use the full resolutionimage. Full resolution images are rarely used, in practice, however,because the resulting increase in computation time is excessive, and isincompatible with the requirements of image-guided radiosurgery.

Generally, similarity measure methods used in 2D/3D registration can bedivided into two categories. The first method is based on imagefeatures. The image features could be anatomical edges or segmentedobjects. The registration accuracy depends on the accuracy of edgedetection or object segmentation. The main advantage of this method isits fast computation. Feature-based similarity methods register onsalient features that have been segmented from each image. They use areduced amount of data, which makes the algorithms fast, once thesegmentation has been undertaken. Because the full information contentof the image is not used, however, the accuracy is sacrificed. Errors inthe segmentation stage can lead to an error in the final registration.

The second method is based on image intensity content. Intensity-basedmethods compare the voxel and pixel values directly, using measuresbased on image statistics. The original images are used forregistration. Usually, a good accuracy can be achieved. Although thesemethods require little or no segmentation, intensity-based methods aretypically much slower. Because a long time computation is required, itis hard to apply intensity-based similarity measures to clinicalpractice.

In a co-pending patent application (referred to by attorney docketnumber ACCL-125; henceforth the “ACCL-125 application”), a method andsystem for 2D/3D image registration is disclosed that uses ahierarchical and iterative framework for the registration algorithm, toachieve a higher accuracy with less computing time. The ACCL-125application is owned by the assignee of the present application, and ishereby incorporated by reference in its entirety. In the ACCL-125application, a 2D/3D image registration procedure is disclosed thatincludes the steps of 1) performing a 3D multi-level matching todetermine an initial estimate in-plane transformation parameters, 2)performing an initial 1-D search for each of a pair of out-of-planerotation parameters, then 3) iteratively refining the in-planeparameters (x, y, θ) and the out-of-plane parameters (r, φ), until theparameters converge to a desired accuracy. The similarity measuremethods disclosed in the present invention are designed to optimize the2D/3D image registration procedure disclosed in the ACCL-125application.

The similarity measure method of the present invention is based onpattern intensity, and provides a powerful and efficient way to solvethe 2D/3D image registration procedure, as disclosed in the ACCL-125application. In particular, the pattern intensity based method andsystem of the present invention is designed for the 1D search phase (forthe out-of-plane parameters), and the iterative refining phases of the2D/3D image registration procedure disclosed in the ACCL-125application.

For the 3D multi-level search phase, the “sum of absolute differences”(SAD) measure is used, which is a known, simple similarity measure. TheSAD measure is widely used in medical image processing and videoprocessing, in cases where the two images to be matched have high imagequality. The main advantage of using SAD is its fast computation and itseasy optimization in parallel computation. Its main disadvantage is thatthe solution is sensitive to image noise, artifacts and intensitydifference between the live and DRR images. As a result, SAD is onlyused in the first search phase to get approximate results. SAD can beexpressed as${{SAD} = {\sum\limits_{i,j}^{\quad}\left| {{I_{Live}\left( {i,j} \right)} - {I_{DRR}\left( {i,j} \right)}} \right|}},$where I_(live)(i, j) represents the intensity of the “live” real-timex-ray image, and I_(DRR)(i, j) represents the intensity of thereconstructed DRR image.

The pattern intensity similarity measure of the present invention ismore accurate, and less sensitive to image noise, artifacts, and to theintensity difference between the images being compared. In the exemplaryembodiment described in the following paragraphs, the first image is a2D x-ray image of a radiosurgical treatment target, and the second imageis a 2D DRR that is reconstructed from 3D CT scan data generated at thetime of treatment planning. In a preferred embodiment, the two imagesare discretized, digital images, characterized by first and second 2Darrays of pixel values. The pixel arrays are equi-dimensional, i.e. thenumber of rows and columns of the first array is equal to the number ofrows and columns of the second array. As well known, each pixel value ofan image is a number representative of the intensity of the image at aunique corresponding 2D area element forming the image.

A difference image is formed from the real-time x-ray image and the DRRimage, by subtracting the corresponding pixel values of the second image(the DRR image) from each pixel value of the first image (thereal-time):I _(dif)(i, j)=I _(Live)(i, j)−I _(DRR)(i, j),where I_(dif)(ij) represents the intensity or pixel value of the ij-thpixel of the difference image,I_(live)(ij) represents the intensity or pixel value of the ij-th pixelof the live x-ray image; andI_(DRR)(i,j) represents the intensity or pixel value of the ij-th pixelof the artificial DRR image.

A pattern intensity function is defined, which operates on thedifference image. The pattern intensity function is expressed as anasymptotic function of the gradients of the difference image:$\begin{matrix}{{\sum\limits_{i,j}^{\quad}{\sum\limits_{k,{l \Subset R}}^{\quad}\frac{\sigma^{2}}{\sigma^{2} + \left( {{I_{dif}\left( {i,j} \right)} - {I_{dif}\left( {{i + k},{j + l}} \right)}} \right)^{2}}}},} & (1)\end{matrix}$where σ is a weighting constant and R is a neighborhood that is definedusing the pixel (i, j) as the center point. The form of the mathematicalformulation results in the similarity measure tending to a maximumvalue, as the number of structures tend to zero, and the similaritymeasure asymptotically tending to zero, as the number of structuresincrease. Because of the asymptotic nature of the pattern intensitymeasure, large differences in intensity have the same effect on themeasure, regardless of their magnitude. This makes the measure robust tolarge differences in pixel intensity.

The function is weighted by the weighting constant a. The constant a isused to weight the function, so that small deviations in intensity(caused by noise, by way of example) results in the measure remainingproximate to its maximum value. The sensitivity of the solution to thevariation of X-ray image can be minimized by careful selection of thisconstant. The larger the weighting constant, the more stable the resultsbecome. However, the choice of the weighting constant is a tradeoffbetween stability and accuracy. If the value of the weighting constantis too large, the smaller details in the images cannot be reflected inthe similarity measure. Based on experimentation, the empirical value ofσ is determined to be in the range from about 4 to about 16, althoughother values of σ are also within the scope of the present invention.

The pattern intensity function considers a selected neighborhood foreach pixel. In a preferred embodiment of the invention, illustrated inFIG. 2, the neighborhood R is defined such that the gradients in fourdirections are considered: horizontal, vertical, 45° diagonal and −45°diagonal. As shown in FIG. 2, in the horizontal direction, the (i,j−1)-th pixel is considered. In the vertical direction, the (i−1 j)-thpixel is considered. In the 45° diagonal direction, the (i−1, j+1)-thpixel is considered. In the −45° direction, the (i−1, j−1)-th pixel isconsidered.

Based on the definition of the neighborhood R as shown in FIG. 2, thepattern intensity expression is given as the sum below: $\begin{matrix}\begin{matrix}{{\sum\limits_{i,j}^{\quad}\frac{\sigma^{2}}{\sigma^{2} + \left( {{I_{dif}\left( {i,j} \right)} - {I_{dif}\left( {i,{j - 1}} \right)}} \right)^{2}}} + {\sum\limits_{i,j}^{\quad}\frac{\sigma^{2}}{\sigma^{2} + \left( {{I_{dif}\left( {i,j} \right)} - {I_{dif}\left( {{i - 1},j} \right)}} \right)^{2}}} +} \\{{\sum\limits_{i,j}^{\quad}\frac{\sigma^{2}}{\sigma^{2} + \left( {{I_{dif}\left( {i,j} \right)} - {I_{dif}\left( {{i - 1},{j - 1}} \right)}} \right)^{2}}} + {\sum\limits_{i,j}^{\quad}\frac{\sigma^{2}}{\sigma^{2} + \left( {{I_{dif}\left( {i,j} \right)} - {I_{dif}\left( {{i - 1},{j + 1}} \right)}} \right)^{2}}}}\end{matrix} & (2)\end{matrix}$The formulation of the pattern intensity function, given in equation (2)above, provides a number of advantages over other known similaritymeasures, as discussed in paragraph 41 below.

FIG. 3 schematically illustrates a system 200 for determining, duringimage-guided surgery, the measure of similarity between two images,constructed in accordance with one embodiment of the present invention.The present invention features a system for determining the measure ofsimilarity of a 2D x-ray image of an object, and a 2D DRR of the objectgenerated from previously obtained 3D scan data. Preferably, the x-rayimage and the DRR are discretized digital images, which arecharacterized by a first and second 2D array of pixel values. The systemincludes a 3D scanner for generating 3D scan data of the target. The 3Dscanner may include, but is not limited to, a CT scanner, an MRI system,an ultrasound system, and a PET system.

A radiation source 202 (typically an x-ray source) is provided forgenerating at least one imaging beam (typically an x-ray beam). Animaging system 206 is provided for generating a 2D radiographic image ofthe target in near real time, by directing the imaging beam towards andthrough the target from a known location and angle and at a knownintensity, and detecting the imaging beam after the beam has passedthrough the target. The imaging system 206 is preferably an x-rayimaging system for generating a pair of orthogonal x-ray projectionimages of the target. The imaging system 206 preferably has a pair ofx-ray sources for generating diagnostic imaging beams (having knownpositions, angles, and intensities), and a corresponding pair of x-rayimage detectors which detect the beams after the beams have passedthrough the target.

The system includes a controller 208. The controller 208 includessoftware for generating a set of reconstructed 2D images (preferablyDRRs) of the target, based on the 3D scan data from the 3D scanner 201,and the known intensity, location, and angle of the imaging beams. Thecontroller also includes software for determining the measure ofsimilarity between the 2D x-ray image and the 2D DRR, in a mannerdescribed above in paragraphs 28-36.

The pattern intensity similarity measure of the present inventionprovides a number of advantages over other methods known in the art.First, the difference image filters out the low frequency part that isbasically the soft tissues and keeps the high frequency part that ismostly the skeletal structures. This feature makes the algorithm robustto some brightness intensity difference between live and DRR images.Second, because of the asymptotic nature of the pattern intensityfunction, the similarity measure is less affected by pixels whoseintensity values deviate only slightly from its neighboring pixels.These kinds of pixels are thought to contain random noise, henceundesirable. Third, because the asymptotic function quickly approachesto zero when the variable increases, large intensity differences such asimage artifacts have the same effects on the similarity measure,regardless of their magnitude. Accordingly, the pattern intensity isless sensitive to image artifacts.

While the invention has been particularly shown and described withreference to specific preferred embodiments, it should be understood bythose skilled in the art that various changes in form and detail may bemade therein without departing from the spirit and scope of theinvention as defined by the appended claims.

1. A method in image-guided surgery for determining the measure ofsimilarity of a first image of an object and a second image of saidobject, the method comprising: a. forming a difference image bysubtracting the corresponding pixel values of the second image from eachpixel value of the first image; wherein said first image is an x-rayimage of said object generated in near real time, and said second imageis a DRR (digitally reconstructed radiograph) synthesized frompreviously generated 3D scan data of said object; and b. forming apattern intensity function by summing asymptotic functions of thegradients of said difference image over all the pixels within aneighborhood R; wherein said neighborhood R is defined so that saidgradients of said difference image can be considered in at least fourdirections.
 2. A method in accordance with claim 1, wherein said patternintensity function is an asymptotic function of the gradients of saiddifference image.
 3. A method in accordance with claim 1, wherein saidfirst and second images, and said difference image, are digital images.4. A method in accordance with claim 1, wherein said first and secondimages are discretized images respectively characterized by a first anda second 2D (two-dimensional) array of pixel values; and wherein saiddifference image is a discretized image characterized by a third 2Darray of pixel values.
 5. A method in accordance with claim 4, whereineach pixel value of an image is a number representative of the intensityof said image at a corresponding 2D array element.
 6. A method inaccordance with claim 4, wherein the number of rows of said first arrayis equal to the number of rows of said second array and said thirdarray, and the number of columns of said first array is equal to thenumber of columns of said second array and said third array.
 7. A methodin accordance with claim 4, wherein the number of rows and columns ofsaid first and second arrays is about
 512. 8. A method in accordancewith claim 1, wherein said x-ray image of said target is obtained bytransmitting through said target an imaging beam having a knownintensity and a known position and angle relative to said target, andwherein said 2D DRR (digitally reconstructed radiographs) representingthe radiographic image of said target that would be obtained with saidimaging beam at said known intensity, position and angle, if said targetwere positioned in accordance with said 3D scan data.
 9. A method inaccordance with claim 4, wherein the pixel value for each imagerepresents the intensity of said image, and wherein the pixel value atthe i-th row and j-th column of said third array of pixel values forsaid difference image is given by:I _(dif)(i,j)=I _(Live)(i,j)−I _(DRR)(i,j), wherein I_(Live)(i,j)represents the (i,j)-th pixel value of a real-time x-ray image of saidobject, and I_(DRR)(i,j) represents the (i,j)th pixel value of adigitally reconstructed image of said object synthesized from previouslygenerated 3D scan data of said object.
 10. A method in accordance withclaim 1, wherein said pattern intensity function is characterized by amathematical formulation given by:${\sum\limits_{i,j}^{\quad}{\sum\limits_{k,{l \Subset R}}^{\quad}\frac{\sigma^{2}}{\sigma^{2} + \left( {{I_{dif}\left( {i,j} \right)} - {I_{dif}\left( {{i + k},{j + l}} \right)}} \right)^{2}}}},$where I_(dif)(i, j) represents the array of pixel values for saiddifference image, where σ is a weighting constant for weighting saidfunction, and where R is a neighborhood defined around the pixel (ij) asa center point.
 11. A method in accordance with claim 10, wherein σ isfrom about 4 to about
 16. 12. A method in accordance with claim 1,wherein said at least four directions comprise: a. a substantiallyhorizontal direction; b. a substantially vertical direction; c. adiagonal direction of about 45 degrees; and d. a diagonal direction ofabout −45 degrees.
 13. A method in accordance with claim 12, Wherein theresult of the sampling of said pattern intensity in said neighborhood R,the pattern intensity function is given by: $\begin{matrix}{{\sum\limits_{i,j}^{\quad}\frac{\sigma^{2}}{\sigma^{2} + \left( {{I_{dif}\left( {i,j} \right)} - {I_{dif}\left( {i,{j - 1}} \right)}} \right)^{2}}} + {\sum\limits_{i,j}^{\quad}\frac{\sigma^{2}}{\sigma^{2} + \left( {{I_{dif}\left( {i,j} \right)} - {I_{dif}\left( {{i - 1},j} \right)}} \right)^{2}}} +} \\{{\sum\limits_{i,j}^{\quad}\frac{\sigma^{2}}{\sigma^{2} + \left( {{I_{dif}\left( {i,j} \right)} - {I_{dif}\left( {{i - 1},{j - 1}} \right)}} \right)^{2}}} + {\sum\limits_{i,j}^{\quad}\frac{\sigma^{2}}{\sigma^{2} + \left( {{I_{dif}\left( {i,j} \right)} - {I_{dif}\left( {{i - 1},{j + 1}} \right)}} \right)^{2}}}}\end{matrix}$
 14. A method in accordance with claim 1, wherein said 3Dscan data comprise at least one of CT scan data, MRI scan data,ultrasound scan data, and PET (positron emission tomography) data.
 15. Asystem for determining the measure of similarity of a 2D x-ray image ofan object and a 2D DRR of said object generated from previously obtained3D scan data, said x-ray image and said DRR being discretized imagescharacterized by a first and second 2D array of pixel values, the systemcomprising: a. means for generating 3D scan data of said object; b. anx-ray source for generating at least one imaging beam; c. imaging meansfor generating a 2D radiographic image of said object in near real time,by directing said imaging beam towards and through said object from aknown location and angle and at a known intensity, and detecting saidimaging beam after said beam has passed through said object; d. acontroller, including: i) software for generating a set of 2D DRR imagesof said object, using said 3D scan data and said known location, angle,and intensity of said imaging beam; and ii) software for determining themeasure of similarity between said 2D x-ray image and said 2D DRR, bysubtracting each pixel value of said second image from a correspondingpixel value of said first image to form a difference image, by addingthe asymptotic functions of the gradients of the difference image overall the pixels within a neighborhood R; wherein said pattern intensityfunction is an asymptotic function of the gradients of said differenceimage; and wherein said neighborhood R is defined so that said gradientsof said difference image can be considered in at least four directions.16. A system in accordance with claim 15, wherein said at least fourdirections comprise: a. a substantially horizontal direction; b. asubstantially vertical direction; c. a diagonal direction of about 45degrees; and d. a diagonal direction of about −45 degrees.
 17. A systemin accordance with claim 15, wherein said pattern intensity function isgiven by:${\sum\limits_{i,j}^{\quad}{\sum\limits_{k,{l \Subset R}}^{\quad}\frac{\sigma^{2}}{\sigma^{2} + \left( {{I_{dif}\left( {i,j} \right)} - {I_{dif}\left( {{i + k},{j + l}} \right)}} \right)^{2}}}},$where I_(dif)(i, j) represents the array of pixel values for saiddifference image, where σ is a weighting constant, and wherein saidneighborhood R uses the pixel (i,j) as a center point.